package cn.jhc.bean;

import java.math.BigDecimal;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="course")
public class Course {
	private Integer courseno;
	private String coursename;
	private BigDecimal credit;
	private Integer classhour;
	private Integer term;
	
	private Set<Study> studies = new HashSet<Study>();
	private Set<Score> scores = new HashSet<Score>();
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="COURSENO")
	public Integer getCourseno() {
		return courseno;
	}
	public void setCourseno(Integer courseno) {
		this.courseno = courseno;
	}
	@Column(name="COURSENAME",columnDefinition="varchar(255)")
	public String getCoursename() {
		return coursename;
	}
	public void setCoursename(String coursename) {
		this.coursename = coursename;
	}
	@Column(name="CREDIT",precision=5,scale=2)
	public BigDecimal getCredit() {
		return credit;
	}
	
	public void setCredit(BigDecimal credit) {
		this.credit = credit;
	}
	@Column(name="CLASSHOUR")
	public Integer getClasshour() {
		return classhour;
	}
	public void setClasshour(Integer classhour) {
		this.classhour = classhour;
	}
	@Column(name="TERM")
	public Integer getTerm() {
		return term;
	}
	public void setTerm(Integer term) {
		this.term = term;
	}
	@OneToMany(mappedBy="course",cascade={CascadeType.ALL})
	public Set<Score> getScores() {
		return scores;
	}
	public void setScores(Set<Score> scores) {
		this.scores = scores;
	}
	@OneToMany(mappedBy="course",cascade={CascadeType.ALL})
	public Set<Study> getStudies() {
		return studies;
	}
	public void setStudies(Set<Study> studies) {
		this.studies = studies;
	}
	
	
}
